package com.cdvtc.fengchao.Servlet;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter("/*")
public class EncodingFilter implements Filter {
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {
        request.setCharacterEncoding("UTF-8");  // 设置请求编码
        response.setCharacterEncoding("UTF-8"); // 设置响应编码
        chain.doFilter(request, response);
    }
}